package com.ecy.quadratic.manager;

import com.ecy.quadratic.beans.ComicDetail;
import com.ecy.quadratic.beans.SectionBean;
import com.ecy.quadratic.beans.support.BookCollectEvent;
import com.ecy.quadratic.beans.support.BookDetailEvent;
import com.ecy.quadratic.beans.support.BookSearchEvent;
import com.ecy.quadratic.beans.support.ComicBrowserEvent;
import com.ecy.quadratic.beans.support.ComicCollectEvent;
import com.ecy.quadratic.beans.support.ComicSearchEvent;
import com.ecy.quadratic.beans.support.ComicSectionsEvent;
import com.ecy.quadratic.beans.support.CommentNumEvent;
import com.ecy.quadratic.beans.support.CommunityEvent;
import com.ecy.quadratic.beans.support.ReadingSectionEvent;
import com.ecy.quadratic.beans.support.RecommendBookEvent;
import com.ecy.quadratic.reader.bean.Recommend;
import com.ecy.quadratic.reader.bean.SearchDetail;
import com.ecy.quadratic.reader.bean.support.RefreshCollectionIconEvent;
import com.ecy.quadratic.reader.bean.support.RefreshCollectionListEvent;
import com.ecy.quadratic.reader.bean.support.SubEvent;

import org.greenrobot.eventbus.EventBus;

import java.util.List;

/**
 * @author yuyh.
 * @date 17/1/30.
 */

public class EventManager {

    public static void refreshCollectionList() {
        EventBus.getDefault().post(new RefreshCollectionListEvent());
    }

    public static void refreshCollectionIcon() {
        EventBus.getDefault().post(new RefreshCollectionIconEvent());
    }

    public static void refreshSubCategory(String minor, String type) {
        EventBus.getDefault().post(new SubEvent(minor, type));
    }

    public static void refreshReadingSection(SectionBean section) {
        EventBus.getDefault().post(new ReadingSectionEvent(section));
    }

    public static void refreshComicBroswer() {
        EventBus.getDefault().post(new ComicBrowserEvent());
    }

    public static void refreshComicCollect() {
        EventBus.getDefault().postSticky(new ComicCollectEvent());
    }

    public static void refreshBookCollect() {
        EventBus.getDefault().postSticky(new BookCollectEvent());
    }

    public static void refreshCommunity() {
        EventBus.getDefault().postSticky(new CommunityEvent());
    }

    public static void updateComicSections(ComicDetail detail) {
        EventBus.getDefault().postSticky(new ComicSectionsEvent(detail));
    }

    public static void updateBookSections(ComicDetail detail) {
        EventBus.getDefault().postSticky(new ComicSectionsEvent(detail));
    }

    public static void updateBookDes(String bookId, String bookDes) {
        EventBus.getDefault().postSticky(new BookDetailEvent(bookId, bookDes));
    }

    public static void updateCommentNum(String communityId) {
        EventBus.getDefault().postSticky(new CommentNumEvent(communityId));
    }

    public static void updateComicSearchh(List<SearchDetail.SearchBooks> searchBooksList) {
        EventBus.getDefault().postSticky(new ComicSearchEvent(searchBooksList));
    }

    public static void updateBookSearchh(List<SearchDetail.SearchBooks> searchBooksList) {
        EventBus.getDefault().postSticky(new BookSearchEvent(searchBooksList));
    }

    public static void updateRecommendBooks(Recommend.RecommendBooks books) {
        EventBus.getDefault().postSticky(new RecommendBookEvent(books));
    }

}
